This README file provides instructions to 
calculate the power of a two-stage design, 
as described in the paper:

JM Satagopan, ES Venkatraman, CB Begg (2004):
Two-stage designs for gene-disease association 
studies with sample size constraints. Biometrics
(to appear).

The file twostageR.r contains the R code, and
utilizes the FORTRAN code twostageR.f and the
C code rshared.c. 

Instructions:
-------------
(1) First create a shared object twostageR.so using the
    following Unix (or Linux) shell command (you may need
    to use one of the following two commands, depending
    upon your machine and the version of R you are using):

              R CMD SHLIB twostageR.f rshared.c

	      or

	      R SHLIB twostageR.f rshared.c

(2) Dynamically load this into R using the following 
    R command:
          dyn.load("twostageR.so")

(3) Source the file twostageR.r containing the twostage.power
    function using the following R command:
          source("twostageR.r")

(4) The function twostage.power can be run using the following
    command. Suppose the sample size is n=100, there are m=100
    markers, the signal of a single true marker is mu=0.345, the
    true marker of association is the 50th marker [i.e., mu.loc=50],
    the two-stage design utilizes 50% of the individuals in Stage 1
    [i.e., j.value = 0.50], and selects the promising top 10% of the
    markers for further evaluation in Stage 2 [i.e., i.value = 0.10],
    the correlation between adjacent markers is characterizes by 
    rho=0.60, and rho0=0.10, and we are interested in identifying 
    a single true marker [i.e., true.needed=1], using nsim=1000 Monte
    Carlo simulation the power of the two-stage can be estimated using
    the following command:

         twostage.power(n=100, m=100, mu=0.345, mu.loc=50,
                        i.value=0.10, j.value=0.50,
                        rho=0.6, rho0=0, true.needed=1, 
                        nsim = 1000)


    When there are D=5 true markers, the location of these five markers
    is specified as a vector i.e., mu.loc=c(25, 38, 55, 70, 88) in the
    above function. 

    Note1: Setting i.value=1.0 and j.value=1.0 gives the power of a one-stage
           design.

--------------------------- 
Contact Information:

  Jaya M. Satagopan
  Department of Epidemiology and Biostatistics
  Memorial Sloan-Kettering Cancer Center
  307, East 63rd Street
  New York, NY 10021
  email: satagopj@mskcc.org
  Ph: (646) 735-8122
  FAX: (646) 735-0010

